using Perfect.Marshal;
using System.Xml;

namespace editor
{
namespace cfg.obj
{
[System.Serializable]
public  class OpClick : UIOperationItem
 {

    public cfg.blueprint.InvokeBlueprintExecutor onClick  = new cfg.blueprint.InvokeBlueprintExecutor();
     


    public const int TYPE_ID = 1325169542;

    public override int GetTypeId() {
        return TYPE_ID;
    }


    public override void MarshalCompatible(Perfect.Marshal.Octets os) {
        os.WriteSize(8);
        os.WriteSize(Tag.INT | (100 << Tag.TAG_SHIFT));  os.WriteInt(cfgId);  
         os.WriteSize(Tag.BOOL | (101 << Tag.TAG_SHIFT));  os.WriteBool(enable);  
         os.WriteSize(Tag.BEAN | (104 << Tag.TAG_SHIFT));  { var _oldOs = os; os = new Perfect.Marshal.Octets(); cfg.Extensions.marshal_compatible_cfg_condition_Condition(showCondition,os);  _oldOs.WriteOctets(os); os = _oldOs;}  
         os.WriteSize(Tag.BEAN | (105 << Tag.TAG_SHIFT));  { var _oldOs = os; os = new Perfect.Marshal.Octets(); cfg.Extensions.marshal_compatible_cfg_condition_Condition(interactionCondition,os);  _oldOs.WriteOctets(os); os = _oldOs;}  
         os.WriteSize(Tag.BEAN | (106 << Tag.TAG_SHIFT));  { var _oldOs = os; os = new Perfect.Marshal.Octets(); cfg.Extensions.marshal_compatible_cfg_bonus_Bonus(bonus,os);  _oldOs.WriteOctets(os); os = _oldOs;}  
         os.WriteSize(Tag.STRING | (107 << Tag.TAG_SHIFT));  os.WriteString(buttonIcon);  
         os.WriteSize(Tag.STRING | (108 << Tag.TAG_SHIFT));  os.WriteString(buttonName);  
         os.WriteSize(Tag.BEAN | (201 << Tag.TAG_SHIFT));  { var _oldOs = os; os = new Perfect.Marshal.Octets(); cfg.Extensions.marshal_compatible_cfg_blueprint_InvokeBlueprintExecutor(onClick,os);  _oldOs.WriteOctets(os); os = _oldOs;}  
         
    }

    public override void UnmarshalCompatible(Perfect.Marshal.Octets os) {
        for (int _var_num_ = os.ReadSize(); _var_num_-- > 0; ) {
            int _id_ = os.ReadSize();
            switch (_id_)
            {
            case (Tag.INT | (100 << Tag.TAG_SHIFT)):   cfgId = os.ReadInt(); break;  
             case (Tag.BOOL | (101 << Tag.TAG_SHIFT)):   enable = os.ReadBool(); break;  
             case (Tag.BEAN | (104 << Tag.TAG_SHIFT)):  { var _oldOs = os; os = os.ReadOctets(); showCondition = cfg.Extensions.unmarshal_compatible_cfg_condition_Condition(os); os = _oldOs; break; }   
             case (Tag.BEAN | (105 << Tag.TAG_SHIFT)):  { var _oldOs = os; os = os.ReadOctets(); interactionCondition = cfg.Extensions.unmarshal_compatible_cfg_condition_Condition(os); os = _oldOs; break; }   
             case (Tag.BEAN | (106 << Tag.TAG_SHIFT)):  { var _oldOs = os; os = os.ReadOctets(); bonus = cfg.Extensions.unmarshal_compatible_cfg_bonus_Bonus(os); os = _oldOs; break; }   
             case (Tag.STRING | (107 << Tag.TAG_SHIFT)):   buttonIcon = os.ReadString(); break;  
             case (Tag.STRING | (108 << Tag.TAG_SHIFT)):   buttonName = os.ReadString(); break;  
             case (Tag.BEAN | (201 << Tag.TAG_SHIFT)):  { var _oldOs = os; os = os.ReadOctets(); onClick = cfg.Extensions.unmarshal_compatible_cfg_blueprint_InvokeBlueprintExecutor(os); os = _oldOs; break; }   
             
            default: Tag.SkipUnknownField(_id_, os); break;
            }
         }
    }
    public override void MarshalXml(XmlWriter ele)
    {
        ele.WriteAttributeString("type", "OpClick");
        ele.WriteStartElement("cfgId"); ele.WriteAttributeString("id", "100"); ele.WriteInt(cfgId); ele.WriteEndElement();
         ele.WriteStartElement("enable"); ele.WriteAttributeString("id", "101"); ele.WriteBool(enable); ele.WriteEndElement();
         ele.WriteStartElement("showCondition"); ele.WriteAttributeString("id", "104"); cfg.Extensions.xml_marshal_cfg_condition_Condition(showCondition,ele); ele.WriteEndElement();
         ele.WriteStartElement("interactionCondition"); ele.WriteAttributeString("id", "105"); cfg.Extensions.xml_marshal_cfg_condition_Condition(interactionCondition,ele); ele.WriteEndElement();
         ele.WriteStartElement("bonus"); ele.WriteAttributeString("id", "106"); cfg.Extensions.xml_marshal_cfg_bonus_Bonus(bonus,ele); ele.WriteEndElement();
         ele.WriteStartElement("buttonIcon"); ele.WriteAttributeString("id", "107"); ele.WriteString2(buttonIcon); ele.WriteEndElement();
         ele.WriteStartElement("buttonName"); ele.WriteAttributeString("id", "108"); ele.WriteString2(buttonName); ele.WriteEndElement();
         ele.WriteStartElement("onClick"); ele.WriteAttributeString("id", "201"); cfg.Extensions.xml_marshal_cfg_blueprint_InvokeBlueprintExecutor(onClick,ele); ele.WriteEndElement();
         
    }

    public override void UnmarshalXml(XmlElement ele)
    {
        foreach (XmlElement e in ele.GetChildren())
        {
            if (int.TryParse(ele.GetAttribute("id"), out var _id_))
            {
                switch (_id_)
                {
                case 100:  cfgId = ele.ReadInt(); break; 
                 case 101:  enable = ele.ReadBool(); break; 
                 case 104:  showCondition = cfg.Extensions.xml_unmarshal_cfg_condition_Condition(ele); break; 
                 case 105:  interactionCondition = cfg.Extensions.xml_unmarshal_cfg_condition_Condition(ele); break; 
                 case 106:  bonus = cfg.Extensions.xml_unmarshal_cfg_bonus_Bonus(ele); break; 
                 case 107:  buttonIcon = ele.ReadString2(); break; 
                 case 108:  buttonName = ele.ReadString2(); break; 
                 case 201:  onClick = cfg.Extensions.xml_unmarshal_cfg_blueprint_InvokeBlueprintExecutor(ele); break; 
                 
                default: break;
                }
            }
            else
            {
                switch (e.Name)
                {
                case "cfg_id":  cfgId = ele.ReadInt(); break; 
                 case "enable":  enable = ele.ReadBool(); break; 
                 case "show_condition":  showCondition = cfg.Extensions.xml_unmarshal_cfg_condition_Condition(ele); break; 
                 case "interaction_condition":  interactionCondition = cfg.Extensions.xml_unmarshal_cfg_condition_Condition(ele); break; 
                 case "bonus":  bonus = cfg.Extensions.xml_unmarshal_cfg_bonus_Bonus(ele); break; 
                 case "button_icon":  buttonIcon = ele.ReadString2(); break; 
                 case "button_name":  buttonName = ele.ReadString2(); break; 
                 case "on_click":  onClick = cfg.Extensions.xml_unmarshal_cfg_blueprint_InvokeBlueprintExecutor(ele); break; 
                 
                default: break;
                }
            }
        }
    }
}
}
}
